import axios from 'axios'

//查询角色列表
export const findRolePage = (current, size, roleVo) => {
  return axios({
    url: '/api/role/findRolePage',
    method: 'post',
    params: {
      current,
      size
    },
    /*json数据传值*/
    data: roleVo
  })
}

//查询所有角色列表
export const getRoleList = () => {
  return axios({
    url: '/api/role/getRoleList',
    method: 'get',
  })
}

//添加角色
export const roleAdd = (roleVo) => {
  return axios({
    url: '/api/role/add',
    method: 'post',
    data: roleVo
  })
}

//删除角色
export const roleDelete = (id) => {
  return axios({
    url: '/api/role/delete',
    method: 'delete',
    params: {
      id
    }
  })
}

//更新角色
export const roleUpdate = (id, roleVo) => {
  return axios({
    url: '/api/role/update',
    method: 'put',
    params: {
      id
    },
    data: roleVo
  })
}

//更新角色状态
export const roleUpdateStatus = (id, status) => {
  return axios({
    url: '/api/role/updateStatus',
    method: 'put',
    params: {
      id,
      status
    },
  })
}

//获取菜单树和角色拥有的菜单id
export const findRoleMenu = (id) => {
  return axios({
    url: '/api/role/findRoleMenu',
    method: 'get',
    params: {
      id,
    },
  })
}

//角色授权
export const authority = (id, mids) => {
  return axios({
    url: '/api/role/authority',
    method: 'post',
    params: {
      id,
    },
    data: mids
  })
}

/*导出用户列表*/
export const downRoleExcel = () => {
  return axios({
    url: '/api/role/excel',
    method: 'post',
    responseType: 'blob'
  })
}


